package com.qf.config;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import org.springframework.context.annotation.Configuration;

import javax.servlet.http.HttpServletRequest;

/**
 * 根据当前类，设置授权规则的方式，根据ip地址，做黑白名单选项
 * @author zhaojian
 */

@Configuration
public class BlackAndWhiteNamesConfig implements RequestOriginParser {

    @Override
    public String parseOrigin(HttpServletRequest request) {
        // 根据ip地址,做黑白名单
        String ip = request.getRemoteAddr();
        return ip;
    }
}